package exec;

import java.util.Stack;

/**
* @description: leetcode232
* @author: wangjun
* @create: 2022-04-24
*/
public class LeetCode232 {

    Stack<Integer> stack1 = new Stack<>();
    Stack<Integer> stack2 = new Stack<>();

    public LeetCode232(){

    }

    public void push(int x) {
        stack1.push(x);
        stack2.push(stack1.pop());
    }

    public int pop() {
        if(empty()){
            throw new RuntimeException("队列为空");
        }
        return stack2.pop();
    }

    public int peek() {
        return stack2.peek();
    }

    public boolean empty() {
        return stack2.isEmpty();
    }
}